//
//  HMStatusCell.swift
//  Weibo
//
//  Created by HM on 16/5/23.
//  Copyright © 2016年 itheima. All rights reserved.
//  微博首页自定义cell

import UIKit
import SnapKit

class ZZStatusTableViewCell: UITableViewCell {
    
    //
    var status : ZZStatus? {
    
        didSet{
        
        //给原创微博的模型赋值
            statusOrginalView.status = status
        }
    }

    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.selectionStyle = .None

        setupUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    
    func setupUI() {
    //添加原创微博的视图
    contentView.addSubview(statusOrginalView)
        contentView.addSubview(statusToolBar)
    
    statusOrginalView.snp_makeConstraints { (make) in
        
        make.top.left.right.equalTo(self.contentView)

        }
        
       statusToolBar.snp_makeConstraints { (make) in
        
        make.top.equalTo(statusOrginalView.snp_bottom)
        make.right.left.equalTo(self.contentView)
        make.height.equalTo(46)
        }
        
       //给contentView添加约束
        contentView.snp_makeConstraints { (make) in
             //TODO: make 表示取消contentView的frame布局,要手动加上
            make.top.left.right.equalTo(self)
            
            make.top.equalTo(statusOrginalView.snp_top)
            make.bottom.equalTo(statusToolBar.snp_bottom)
            
        }
    }
    
    //懒加载原创微博视图
    private lazy var statusOrginalView : ZZStatusOriginalView = ZZStatusOriginalView()
    
    private lazy var statusToolBar : ZZStatusToolBar = ZZStatusToolBar()
   
}
